All Questions
Tagged with postgresqlpython-3.x
19 questions
1vote
0answers
40views
Get the difference between two sets from database
Hello beautiful people! I have created a script where I have two database functions (Feed and Product) where I have a list of Feeds in a store and a list of Product in the store. What I have done is ...
1vote
1answer
195views
Get Gzip file from endpoint, extract data and add to database
I currently have a script that fires a request to an API endpoint which returns a csv.gzip file - which roughly contains 75,000 rows and 15 columns. I download this ...
4votes
1answer
138views
Django User Model to authenticate using email address and password
This is my second Django project for an actual client and I want some review on one of my important models. This model will be responsible for authenticating users using their E-Mail Addresses and ...
1vote
1answer
86views
Queries using ORM and PostgreSQL
After yesterday suggestions, I was told... recommended to move over to ORM and I did. I choosed to use PeeWee together with PostgreSQL. Queries for storing and get information from postgreSQL This is ...
6votes
1answer
835views
Air Quality/Environment Monitoring Web App using Plotly Dash
Overview & Motivation This project manages and displays sensor data (temperature, humidity, Air Quality Index). The sensor data is displayed by the sensor manufacturer, PurpleAir, but their tool ...
2votes
0answers
30views
A task to store user's favorited projects in postgres using python
I am not happy with two functions calling get_user() since while testing I mock get_user and to test with get_user_returns_null case, it returns Null for both ...
3votes
1answer
78views
Getting weather and cycling data (yr.no, oslobysykkel)
What I am trying to do, is to get weather data, data about bike trips and populate the postgresql database in order to be able to work with this data from Power BI/Tableau/any other tool. I have two ...
2votes
0answers
36views
Handling failures in DB transactions
This code is meant to retry the db operation when a DB connection breaks: OperationalError. A transaction can fail for example when a db is being restarted and a commit fails. Or when a network error ...
3votes
0answers
56views
Django migration script to add metadata
I made a simple django migration that adds two field to our Invoices model : first_payment and first_paying_month. ...
4votes
0answers
111views
Interacting with PostgreSQL attachment and the file system
I have just migrated from Python 2 to Python 3. I have written the following script to fetch all records of a table, ir_attachment, from PostgreSQL. After fetching all the records I check following ...
3votes
2answers
1kviews
Importing data into PostgreSQL from remote text file using ftplib class
I need to read a remote file using FTP and process it and insert the processed data to a PostgreSQL database in another server. The below code is working fine, but i want some advice to modify few ...
1vote
1answer
2kviews
Port the data from a TEXT file to Postgres table using Python
I have written the below code to read a huge text file of size 20+ MB and insert the values to a PostgreSQL table. The code is working fine, but I'm facing below issues in the code. 1) The code is ...
5votes
1answer
59views
SQL Bulk status update
Context I'm a duck retailer. I rent ducks to farmers, and when they don't need them anymore, I get them back. In order to track which ducks I rented to whom, I have a PostGreSQL database that I keep ...
3votes
0answers
31views
Context manager to temporarily drop indexes and constraints on a table
I'm importing millions of rows into a PostgreSQL database using a foreign data wrapper. To speed this up I've written this context manager to DROP all the indexes ...
3votes
1answer
4kviews
Fetch, parse, and store JSON in PostgreSQL
I was given a task to read JSON from a URL and then parse it in python. Each field will be assigned to a variable to store the value. The value will then be stored into postgres table. Example of ...